package com.wang.controller;

import com.wang.result.BaseResponse;
import com.wang.result.ResultUtils;
import com.wang.user.model.ShopCollection;
import com.wang.user.model.Upvote;
import com.wang.user.service.UpvoteService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/upvote")
@Api(tags = "帖子点赞表")
public class UpvoteController {
    @Resource
    private UpvoteService upvoteService;

    @PostMapping("/submit")
    @ApiOperation(value = "点赞帖子")
    public BaseResponse<Boolean> submit(@RequestBody Upvote upvote) {
        return ResultUtils.success(upvoteService.submit(upvote));
    }

    @PostMapping("/cancel")
    @ApiOperation(value = "取消点赞")
    public BaseResponse<Boolean> cancel(@RequestBody Upvote upvote) {
        return ResultUtils.success(upvoteService.cancel(upvote));
    }
}
